<?php
ini_set("display_errors",0);
error_reporting(0);
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application/'));

// Define path to application directory
defined('CONFIG_PATH')
    || define('CONFIG_PATH', realpath(dirname(__FILE__) . '/configs/'));
    
// Define path to application directory
defined('LIBS_PATH')
    || define('LIBS_PATH', realpath(dirname(__FILE__) . '/library/'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    LIBS_PATH,
    get_include_path(),
)));

set_include_path(APPLICATION_PATH.'/models'.PATH_SEPARATOR.get_include_path());
set_include_path(APPLICATION_PATH.'/controllers'.PATH_SEPARATOR.get_include_path());
set_include_path(LIBS_PATH.'/Defined/CacheEngine'.PATH_SEPARATOR.get_include_path());
set_include_path(CONFIG_PATH.PATH_SEPARATOR.get_include_path());
#include_once APPLICATION_PATH.'/controllers/BaseController.php';
/** Zend_Application */
require LIBS_PATH.'/Defined/Common.php';

require LIBS_PATH.'/Defined/LoadObject.php';
/** Zend_Application */
require 'Zend/Application.php'; 
require_once CONFIG_PATH."/define.php";

/** Create application, bootstrap, and run*/
$application = new Zend_Application(
    APPLICATION_ENV,
    CONFIG_PATH.'/application.ini'
);

require_once CONFIG_PATH."/config_site.php";
Zend_Registry::set('config_site',$config_site);

/** load url key for seo 
require_once CONFIG_PATH.'/url_config.php';
Zend_Registry::set('arrURL_key',$arrURL_key);
 */

/** load config ini */
$zend_config=new Zend_Config_Ini(CONFIG_PATH.'/application.ini','production');
Zend_Registry::set('zend_config',$zend_config);
/** load global function*/

require CONFIG_PATH."/global.php";
Globals::connectdb();
Zend_Registry::set('db', Globals::$db);

/** start auto loader */
$loader=Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);


/** run bootstrap for site */


if(!defined('DONT_RUN_APP') || DONT_RUN_APP == false) {  
   $application->bootstrap()
		    ->run();
}

 


    
